luci-app-vnstat2: fix configuration page when database is empty (#6746)
authorJan Hoffmann <[email protected]>
Wed, 6 Dec 2023 01:24:25 +0000 (02:24 +0100)
committerPaul Donald <[email protected]>
Wed, 6 Dec 2023 01:27:12 +0000 (02:27 +0100)
commit3e7604219d8249d25dac562482b0f56cf7266768
treed35a93642baa0e005a176ad7a3f64280a6b0f390
parent138595a7b6918896cd7686bdbaeef44204a987ce
luci-app-vnstat2: fix configuration page when database is empty (#6746)

The output of the command "vnstat --dbiflist 1" is empty when there are
no interfaces in the database. Add a check to avoid a "result.stdout is
undefined" error in that case.

Ref: https://forum.openwrt.org/t/error-in-luci-vnstat2-configuration-menu/179700
Fixes: 3ac4f567dfdf ("luci-app-vnstat2: use more efficient way to get database interfaces")
Signed-off-by: Jan Hoffmann <[email protected]>
(cherry picked from commit c0c37903f2276224c246c2a5ba0fb2732ba0e18a)
applications/luci-app-vnstat2/htdocs/luci-static/resources/view/vnstat2/config.js